import request from '@/utils/request'

export function categoryAdd(opt) {
  return request({
    url: '/category/add.json',
    method: 'post',
    data: {
      hid: opt.hid,
      name: opt.name,
      type: opt.type,
      price: opt.price,
      pic: opt.pic
    }
  })
}

export function categoryUpdate(opt) {
  return request({
    url: '/category/update.json',
    method: 'post',
    data: {
      id: opt.id,
      hid: opt.hid,
      name: opt.name,
      type: opt.type, // 1:布草 2:工作服 3:手术服 4:传染服
      price: opt.price,
      pic: opt.pic
    }
  })
}

export function categoryGetList(query) {
  return request({
    url: '/category/getList.json',
    method: 'get',
    params: query
  })
}

export function categoryGet(query) {
  return request({
    url: '/category/get.json',
    method: 'get',
    params: query
  })
}

export function categoryDelete(query) {
  return request({
    url: '/category/delete.json',
    method: 'get',
    params: query
  })
}
